public class GCD
{

    private static int GCD ( int x , int y )
    {
        if ( y == 0 )
            return x ;
        return GCD ( y , x % y ) ;
    }

    public static void main ( String [ ] args )
    {
        int [ ] m = { 29 , 99 , 1024 } ;
        int count ;

        for ( int p = 0 ; p < 3 ; p ++ )
        {
            count = 0 ;
            for ( int i = 0 ; i < m [ p ] ; i ++ )
            {
                if ( GCD ( i , m [ p ] ) == 1 )
                    count ++ ;
            }

            System.out.println ( "m = " + m [ p ] + " Keys : " + count * m [ p ] ) ;

        }

    }

}
